package com.hby.game

import android.graphics.Color
import android.graphics.Paint
import game.engine.base.Director
import game.engine.base.Label
import game.engine.base.Node
import game.engine.base.Sprite

object HbConfig {
    const val InfoOffsetY = 240f

    fun makeCoinInfo(): Node{
        val director = Director.instance
        val wa = director.windowAdapter
        return Sprite(bitmap = HbyGame.res.infoBgBitmap).apply {
            x = wa.minX + 180f
            y = wa.minY + HbConfig.InfoOffsetY

            // coin
            val coin = Sprite(bitmap = HbyGame.res.coinBitmap)
            coin.x = -100f
            addChild(coin)
            coin.tag = HbTags.CoinIcon

            // text
            val text = Label("0")
            text.x = 10f
            text.textColor = Color.WHITE
            text.align = Paint.Align.CENTER
            addChild(text)
            text.tag = HbTags.CoinText

        }
    }

    fun makeTimeInfo():Node{
        val director = Director.instance
        val wa = director.windowAdapter
        return Sprite(bitmap = HbyGame.res.infoBgBitmap).apply {
            x = wa.maxX - 180f
            y = wa.minY + HbConfig.InfoOffsetY

            // time
            val time = Sprite(
                    bitmap = HbyGame.res.timeBitmap,
                    x = -100f
            )
            addChild(time)

            val timeText = Label("倒计时:10s", align = Paint.Align.CENTER)
            timeText.textColor = Color.WHITE
            timeText.x = 20f
            addChild(timeText)
            timeText.tag = HbTags.TimeText
        }
    }
}

object HbTags{
    const val CoinIcon = 1
    const val CoinText = 2

    const val TimeText = 3
}